//
//  SKUDetailThreeCell.m
//  Tang
//
//  Created by 352324497@qq.com on 15/12/8.
//  Copyright © 2015年 352324497@qq.com. All rights reserved.
//

#import "SKUDetailThreeCell.h"

@implementation SKUDetailThreeCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.selectionStyle = NO;
        CGFloat height = KWidth  * 330 / 620;
        self.photoScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0 * Kx6, KWidth, height) imagesGroup:nil];
        self.photoScrollView.mainView.width = KWidth / 5 * 4;
        // 标题 Label 的背景颜色
        self.photoScrollView.titleLabelBackgroundColor = [UIColor clearColor];
        // 是否自动播放
        self.photoScrollView.autoScroll = NO;
        // 是否显示分页控件
        self.photoScrollView.showPageControl = NO;
        self.photoScrollView.delegate = self;
        self.photoScrollView.placeholderImage = [UIImage imageNamed:@"PCe"];
        [self.contentView addSubview:_photoScrollView];
        
        self.photoArray = [NSMutableArray array];
        self.titleArray = [NSMutableArray array];
    }
    return self;
}

-(void)setPhotoWithArray:(NSMutableArray *)photoArray
{
    if (photoArray.count != 0)
    {
        self.photoArray = photoArray;
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            self.photoScrollView.imageURLStringsGroup = photoArray;
        });
    }
}
-(void)setTitleWithArray:(NSMutableArray *)titleArray
{
    if (titleArray.count != 0)
    {
        self.titleArray = titleArray;
        self.photoScrollView.titlesGroup = titleArray;
        self.photoScrollView.titleLabelTextColor = [UIColor whiteColor];
        self.photoScrollView.titleLabelTextFont = [UIFont systemFontOfSize:18 * Kx6];
    }
}

-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    if ([self.delegate respondsToSelector:@selector(selectedPageWithIndex:)]) {
        [self.delegate selectedPageWithIndex:index];
    }
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
